﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Web.Mvc;
using System.Web.Security;

namespace Project5.Models
{
    public class EditModel
    {
        [Required]
        [RegularExpression(@"^[a-zA-Z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([a-zA-Z0-9]+)(([\.\-‌​]?[a-zA-Z0-9]+)*)\.([a-zA-Z]{2,})$",
           ErrorMessage = "Email address is not valid")]
        [Display(Name = "Email address")]
        public string Email { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Required]
        [DataType(DataType.Text)]
        [Display(Name = "Question")]
        public string Question { get; set; }

        [Required]
        [DataType(DataType.Text)]
        [Display(Name = "Answer")]
        public string Answer { get; set; }
    }

    public class RecoveryRequestModel
    {
        [Required]
        [RegularExpression(@"^[a-zA-Z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([a-zA-Z0-9]+)(([\.\-‌​]?[a-zA-Z0-9]+)*)\.([a-zA-Z]{2,})$",
            ErrorMessage = "Email address is not valid")]
        public string Email { get; set; }
    }

    public class RecoveryModel
    {
        public string Email { get; set; }
        public string Question { get; set; }

        [Required]
        [Display(Name = "Answer")]
        public string Answer { get; set; }
    }

    public class LogOnModel
    {
        [Required]
        [RegularExpression(@"^[a-zA-Z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([a-zA-Z0-9]+)(([\.\-‌​]?[a-zA-Z0-9]+)*)\.([a-zA-Z]{2,})$",
            ErrorMessage = "Email address is not valid")]
        public string Email { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel
    {
        [Required]
        [RegularExpression(@"^[a-zA-Z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([a-zA-Z0-9]+)(([\.\-‌​]?[a-zA-Z0-9]+)*)\.([a-zA-Z]{2,})$",
           ErrorMessage = "Email address is not valid")]
        [Display(Name = "Email address")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 8)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        [Required]
        [DataType(DataType.Text)]
        [Display(Name = "Security Question")]
        public string Question { get; set; }

        [Required]
        [DataType(DataType.Text)]
        [Display(Name = "Security Answer")]
        public string Answer { get; set; }
    }

    public class ChangePasswordModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Current password")]
        public string OldPassword { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 8)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }
}
